package com.example.teamtribe.main.club.clubmembers;

import com.example.teamtribe.common.Back;
import com.example.teamtribe.common.CallbackStore;
import com.example.teamtribe.utils.HttpUtil;
import com.example.teamtribe.utils.URLStore;
import com.example.teamtribe.utils.Utility;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by lenovo on 2018/5/26.
 */

public class MembersModel {
    public void getPresident(int teamId, Back back){
        Map<String, String> params = new HashMap<>();
        params.put("teamId",teamId+"");
        params.put("roleId","2");
        HttpUtil.post(URLStore.TEAM_ROLE_GET,params, CallbackStore.getIdsCallback(back));
    }
    public void getAdmins(int teamId, Back back){
        Map<String, String> params = new HashMap<>();
        params.put("teamId",teamId+"");
        params.put("roleId","3");
        HttpUtil.post(URLStore.TEAM_ROLE_GET,params, CallbackStore.getIdsCallback(back));
    }
    public void getMembers(int teamId, int offset,int num,Back back){
        Map<String, String> params = new HashMap<>();
        params.put("teamId",teamId+"");
        params.put("offset",offset+"");
        params.put("num",num+"");
        HttpUtil.post(URLStore.TEAM_MEMBER_GET,params, CallbackStore.getIdsCallback(back));
    }
    public void addRole(int teamId,int roleId,Back back){
        Map<String, String> params=new HashMap<>();
        params.put("TeamTribeToken", Utility.getToken());
        params.put("teamId", teamId+"");
        params.put("roleId", roleId+"");
        params.put("userId", Utility.getUser().getId()+"");
        HttpUtil.post(URLStore.TEAM_ROLE_ADD,params, CallbackStore.getCallback(back));
    }
}
